<template>
			<!-- This footer should be hidden by default and shown when there are todos -->
			<footer class="footer">
				<!-- This should be `0 items left` by default -->
				<span class="todo-count"><strong>{{unFinished}}</strong> 剩余未完成</span>
				<!-- Remove this if you don't implement routing -->
				<ul class="filters" @click="changeList">
					<li>
						<a :class="{selected:type==='all'}" href="#/" @click="type='all'">全部</a>
					</li>
					<li>
						<a :class="{selected:type==='no'}" href="#/active" @click="type='no'">未完成</a>
					</li>
					<li>
						<a class="{selected:type==='yes'}"  href="#/completed" @click="type='yes'">已完成</a>
					</li>
				</ul>
				<!-- Hidden if no completed items are left ↓ -->
				<button class="clear-completed" @click="clear">清除已完成</button>
			</footer>
</template>

<script>
export default {
  data(){
    return{
      type:'all'//no yes
    }
  },
  props: ['arr'],
  computed: {
    unFinished(){
      return this.arr.filter(item=>{return item.isDone===false}).length
    }
  },
  methods:{
    changeList(){
      this.$emit('changFn',this.type)
    },
    clear(){
      this.$emit('clearFn')
    }
  }
}
</script>

<style>

</style>